<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html">
<ui:composition template="/WEB-INF/views/editDialog.xhtml">
    <f:loadBundle var="msg" basename="pl.pawluk.inz.web.SpringResourceBundle"/>
    <ui:define name="editDialogHeader"><h:outputText value="#{msg.editUser}"/></ui:define>
    <ui:define name="editDialogBody">
        <p:outputLabel for="fName" value="#{msg.name}"/>
        <p:inputText id="fName" value="#{usersBean.user.firstName}"/>
        <p:outputLabel for="mName" value="#{msg.middleName}"/>
        <p:inputText id="mName" value="#{usersBean.user.middleName}"/>
        <p:outputLabel for="sName" value="#{msg.surname}"/>
        <p:inputText id="sName" value="#{usersBean.user.surname}"/>
        <p:outputLabel for="uActive" value="#{msg.activity}"/>
        <p:selectBooleanButton id="uActive" onLabel="#{msg.active}" offLabel="#{msg.inactive}"
                               value="#{usersBean.user.active}"/>
        <p:outputLabel for="iEmail" value="#{msg.email}"/>
        <p:inputText id="iEmail" value="#{usersBean.user.email}"/>
        <p:outputLabel for="iPassword" value="#{msg.password}"/>
        <p:password id="iPassword" value="#{usersBean.user.password}"/>
        <p:outputLabel for="iAddress" value="#{msg.address}"/>
        <p:inputTextarea id="iAddress" value="#{usersBean.user.address}"/>
        <p:outputLabel for="iCity" value="#{msg.city}"/>
        <p:inputText id="iCity" value="#{usersBean.user.city}"/>
        <p:outputLabel for="iZipCode" value="#{msg.zipCode}"/>
        <p:inputText id="iZipCode" value="#{usersBean.user.zipCode}"/>
        <p:outputLabel for="iAuthorities" value="#{msg.authorities}"/>
        <p:selectManyCheckbox id="iAuthorities" value="#{usersBean.user.authorities}" >
            <f:selectItems value="#{usersBean.authorities}"/>
        </p:selectManyCheckbox>
        <p:outputLabel for="iCourses" value="#{msg.courses}"/>
        <p:selectManyMenu id="iCourses" value="#{usersBean.user.courses}">
            <f:selectItems value="#{coursesBean.coursesList}" />
        </p:selectManyMenu>
    </ui:define>
    <ui:define name="editDialogSaveCommand">
        <f:actionListener binding="#{usersBean.updateSelectedRow}"/>
    </ui:define>
</ui:composition>
</html>